package com.aerozhonghuan.archive.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

import java.util.Map;

public class DynamicDataSource extends AbstractRoutingDataSource {

    // 可选：保存所有定义好的数据源（备用）
    private Map<Object, Object> defineTargetDataSources;

    @Override
    protected Object determineCurrentLookupKey() {
        return DynamicDataSourceHolder.getDynamicDataSourceKey();
    }

    public Map<Object, Object> getDefineTargetDataSources() {
        return defineTargetDataSources;
    }

    public void setDefineTargetDataSources(Map<Object, Object> defineTargetDataSources) {
        this.defineTargetDataSources = defineTargetDataSources;
    }
}
